FROM python:3.11.3-slim as builder

COPY ./ /ygcrm_fastapi
WORKDIR /ygcrm_fastapi
RUN pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple && \
pip config set install.trusted-host pypi.tuna.tsinghua.edu.cn && \
pip install poetry -i https://pypi.tuna.tsinghua.edu.cn/simple && \
poetry export --without-hashes -f requirements.txt --output requirements.txt && \
pip install -r requirements.txt
# poetry install
#poetry install --no-root --only main


FROM python:3.11.3-slim
MAINTAINER Tony <wuyong@winning.com.cn>

COPY --from=builder /usr/local/lib/python3.11/site-packages /usr/local/lib/python3.11/site-packages
COPY --from=builder /usr/local/bin/ /usr/local/bin/
COPY --from=builder /ygcrm_fastapi /ygcrm_fastapi
WORKDIR /ygcrm_fastapi
USER root
EXPOSE 8000

# 设置容器启动时运行的命令
CMD ["python", "run.py"]




